package org.example.code.test2024.nine_mouth;

import java.util.*;

public class test0928 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int sum =0;
        for(int i=0;i<n;i++){
            a[i]=in.nextInt();
        }
        Arrays.sort(a);
        int t = n-1;
        for(int i=1;i<n;i++){
            if(a[i]==a[i-1]){
                while(a[i]==a[t]){
                    t--;
                    if(t==0){
                        t=n-1;
                    }
                }
                a[i]=a[i-1]+a[t];
                t=i;
                sum++;
            }
        }
        System.out.println(sum);
    }


}
